import scala.util.Random

class Boot(val name:String) {
  private val random = new Random()
  def randomFocus = Math.abs(random.nextInt()) % 3 + 1

}
object Boot {

  def apply(choice: Int): Boot = {
    if (choice < 1 ||  choice > 3) {
      throw new IndexOutOfBoundsException
    }
    val name = people(choice-1)
    new Boot(name)
  }

  val people = Array("刘备", "关羽", "张飞")
  def peopleList()={
    (1 to 3).zip(people)
      .map(x=>s"${x._1}. ${x._2}")
      .mkString("\t")
  }
}
